package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.service.ImportAndExportSchoolsService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 学生进出校表 前端控制器
 * </p>
 *
 * @author 
 * @since 2020-03-29
 */
@RestController
@RequestMapping("/importAndExportSchools")
public class ImportAndExportSchoolsController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ImportAndExportSchoolsService importAndExportSchoolsServiceImpl;

    /**
     * 教师端查询学生进出校
     * @param request
     * @param classId 班级id
     * @return
     */
    @RequestMapping("/findStudentInAndOut")
    public Result findStudentInAndOut(RequestParameterWrapper request,
                                      @RequestParam(value = "classId") Integer classId){

        logger.info("查询学生进出校信息");
        return  importAndExportSchoolsServiceImpl.findStudentInAndOut(classId);
    }

    /**
     * 统计全校的进出校信息
     * @param request
     * @return
     */
    @RequestMapping("/findInAndOutStatistics")
    public Result findInAndOutStatistics(RequestParameterWrapper request){
        logger.info("查询学生进出校信息");
        //获取学校id
        String schoolId = request.getParam("schoolId");
        return  importAndExportSchoolsServiceImpl.findInAndOutStatistics(schoolId);
    }

}

